package com.claims

import com.claims.code.Type

class Claim {

  Long id
  String submissionNo
  String status
  Double totalAmount
  Clinic clinic
  Employee employee
  Employee verify
  Employee authorize
  Type type
  Date date
  String reason


  Date dateSubmitted
  Date dateVerified
  Date dateApproved
  Date dateRejected

  static belongsTo = [Employee, Clinic, Type]
  static hasMany = [dependants: Dependant]
  static constraints = {
    employee()
    date()
    clinic()
    reason()
    status(inList: ["PREPARED", "SUBMITTED", "VERIFIED","REJECTED", "APPROVED"])
    dateSubmitted()
    dateVerified()
    dateApproved()
    dateRejected()

  }
  static mapping = {
    sort date:'desc'
  }
}
